<?php
class Modules_Cms_Class extends ME_DAL_FileCacheModule
{
	
	protected $_depend = array();

	/**
	* 过期时间
	* @var integer
	*/
	protected $_expire = 3600;

    private $db;
    private function loadDb()
    {
        $this->db = Db_Admin::instance();
    }
	
	public function refresh(array $param = array())
	{
        $appId = (int)$param['appId'];
        
        $this->loadDb();
        
        if(!$appId){
            $appApp = Libs_App::getAllApp();
            if($appApp){
                foreach($appApp as $app){
                    $this->refresh(array("appId" => $app['id']));
                }
            }
            return true;
        }else{
            //取得所有的频道
            $listData = Libs_Cms_Class::getClassArr(array('appId' => $appId));
            $cacheData = array();
            if($listData){
                foreach($listData as $d){
                    $cacheData[$d['id']] = $d;
                }
            }
            $this->set(array('appId'=>$appId),$cacheData);
            return true;
        }
	}
}